﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Web;
using DataAccessLayer;

namespace ServiceLayer.Entity
{
    [DataContract]
    public class StationeryW
    {
        string itemCode;
        int categoryID;
        string itemName;
        string uOM;
        int reorderLevel;
        int reorderQty;
        int availableQty;
        string binNo;

        [DataMember]
        public string ItemCode
        {
            get { return itemCode; }
            set { itemCode = value; }
        }

        [DataMember]
        public int CategoryID
        {
            get { return categoryID; }
            set { categoryID = value; }
        }

        [DataMember]
        public string ItemName
        {
            get { return itemName; }
            set { itemName = value; }
        }

        [DataMember]
        public string UOM
        {
            get { return uOM; }
            set { uOM = value; }
        }

        [DataMember]
        public int ReorderLevel
        {
            get { return reorderLevel; }
            set { reorderLevel = value; }
        }

        [DataMember]
        public int ReorderQty
        {
            get { return reorderQty; }
            set { reorderQty = value; }
        }

        [DataMember]
        public int AvailableQty
        {
            get { return availableQty; }
            set { availableQty = value; }
        }

        [DataMember]
        public string BinNo
        {
            get { return binNo; }
            set { binNo = value; }
        }

        public static StationeryW convert(Stationery stationery)
        {
            StationeryW u = new StationeryW();

            u.ItemCode = stationery.ItemCode;
            u.CategoryID = stationery.CategoryID;
            u.ItemName = stationery.ItemName;
            u.UOM = stationery.UOM;
            u.ReorderLevel = stationery.ReorderLevel;
            u.ReorderQty = stationery.ReorderQty;
            u.AvailableQty = stationery.AvailableQty;
            u.BinNo = stationery.BinNo;

            return u;
        }

        public static List<StationeryW> convertList(List<Stationery> list)
        {
            List<StationeryW> listW = new List<StationeryW>();

            foreach (Stationery x in list)
            {
                listW.Add(convert(x));
            }
            return listW;
        }
    }
}